<?php

/**
 * 生成XML网站地图
 * File Name：XmlController.php
 * File Encoding：UTF-8
 * File New Time：2014-7-15 15:42:47
 * Author：水平凡
 * Mailbox：admin@abc3210.com
 */
class XmlController extends FrontBaseC {

    public function actionSitemap() {
        set_time_limit(200);
        $Sitemap = new Sitemap();
        $url = array(
            array(
                'url' => 'http://www.1zw.com/',
                'priority' => '1.0',
            ),
            array(
                'url' => 'http://www.1zw.com/baoming.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/jj.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/jd.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/qing.html',
                'priority' => 0.8,
            ),
//            array(
//                'url' => 'http://www.1zw.com/index.html?sort=add_time',
//                'priority' => 0.8,
//            ),
//            array(
//                'url' => 'http://www.1zw.com/index.html?sort=default',
//                'priority' => 0.8,
//            ),
//            array(
//                'url' => 'http://www.1zw.com/index.html?sort=promo_price',
//                'priority' => 0.8,
//            ),
//            array(
//                'url' => 'http://www.1zw.com/index.html?sort=sales',
//                'priority' => 0.8,
//            ),
            array(
                'url' => 'http://www.1zw.com/ycid/0.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/tomorrow.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/10.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/9.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/8.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/7.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/6.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/5.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/4.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/3.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/2.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/1.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/jifen.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/shangjia.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/tmall.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/front/download/app.html',
                'priority' => 0.8,
            ),
            array(
                'url' => 'http://www.1zw.com/article/10.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/article/11.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/article/12.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/article/13.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/index/index/page/2.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/index/index/page/3.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/index/index/page/4.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/index/index/page/5.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/cat/tomorrow/page/2.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/cat/tomorrow/page/3.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/cat/tomorrow/page/4.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/cat/tomorrow/page/5.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/cat/yesterday/cid/0/page/2.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/cat/yesterday/cid/0/page/3.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/cat/yesterday/cid/0/page/4.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/cat/yesterday/cid/0/page/5.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/ycid/0/timeico/td.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/cat/yesterday/cid/0/timeico/td/page/2.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/cat/yesterday/cid/0/timeico/td/page/3.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/cat/yesterday/cid/0/timeico/td/page/4.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/cat/yesterday/cid/0/timeico/td/page/5.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/index/index/sort/add_time.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/index/index/sort/sales.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/index/index/sort/sales/page/2.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/index/index/sort/sales/page/3.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/index/index/sort/sales/page/4.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/index/index/sort/promo_price.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/index/index/sort/promo_price/page/2.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/index/index/sort/promo_price/page/3.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/index/index/sort/promo_price/page/4.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/index/index/sort/promo_price/page/5.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/1/timeico/y.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/2/timeico/y.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/3/timeico/y.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/4/timeico/y.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/5/timeico/y.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/6/timeico/y.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/7/timeico/y.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/8/timeico/y.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/9/timeico/y.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/cat/10/timeico/y.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/ycid/0/timeico/td.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/cat/yesterday/cid/0/timeico/td/page/2.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/cat/yesterday/cid/0/timeico/td/page/3.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/cat/yesterday/cid/0/timeico/td/page/4.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/front/cat/yesterday/cid/0/timeico/td/page/5.html',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/baoming.html?special_id=2',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/baoming.html?special_id=3',
                'priority' => 0.7,
            ),
            array(
                'url' => 'http://www.1zw.com/baoming.html?special_id=4',
                'priority' => 0.7,
            ),
//            array(
//                'model' => 'GoodsModel',
//                'criteria' => GoodsModel::model()->where(array('order' => 'goods_id desc', 'limit' => 5000)),
//                'url' => array(0 => 'front/good/show', 'gid' => 'goods_id'),
//                'priority' => 0.6,
//            ),
        );
        $model = GoodsModel::model();
        $data = $model->findAll($model->where(array('order' => 'goods_id desc', 'limit' => 7000)));
        foreach ($data as $rs) {
            $url[] = array(
                'url' => "http://www.1zw.com" . self::U('front/good/show', array('gid' => $rs->goods_id)),
                'time' => date('Y-m-d\TH:i:s+00:00', $rs->add_time),
                'priority' => 0.6,
            );
        }
        $Sitemap->urls = $url;
        $Sitemap->init();
        $Sitemap->generate();
    }

}
